package lesson

import "fmt"

// 定义单个常量
const a int = 1
const b = 'A'
const (
	text   = "123"
	length = len(text)
	num    = b * 20
)

// 同时定义多个变量
const i, j, k = 1, "2", '3'
const (
	text2, length2, num2 = "456", len(text2), k * 10
)

const (
	l = 5
	m
	n
)

const (
	o = "123"
	p = len(o)
	q
)

const (
	r = 'R'
	s
	t = iota
	u
)

// 枚举举例
const (
	Monday = iota
	Tuesday
	Wednesday
	Thursday
	Friday
	Saturday
	Sunday
)

// 课堂作业
const (
	B float64 = 1 << (iota * 10)
	KB
	MB
	GB
	TB
)

func Lesson04() {
	fmt.Println("package lesson file lesson/lesson04.go functino Lesson04")
	fmt.Println("const[a]:", a)
	fmt.Println("const[b]:", b)
	fmt.Println("const[text]:", text)
	fmt.Println("const[length]:", length)
	fmt.Println("const[num]:", num)
	fmt.Println("const[i]:", i)
	fmt.Println("const[j]:", j)
	fmt.Println("const[k]:", k)
	fmt.Println("const[text2]:", text2)
	fmt.Println("const[length2]:", length2)
	fmt.Println("const[num2]:", num2)
	fmt.Println("const[l]:", l)
	fmt.Println("const[m]:", m)
	fmt.Println("const[n]:", n)
	fmt.Println("const[r]:", r)
	fmt.Println("const[s]:", s)
	fmt.Println("const[t]:", t)
	fmt.Println("const[u]:", u)
	fmt.Println("------")
	fmt.Println("[^2]:", ^2)
	fmt.Println("[1^2]:", 1^2)
	fmt.Println("[!true]:", !true)
	fmt.Println("[1 << 10]:", 1<<10)
	fmt.Println("[1 << 10 << 10]:", 1<<10<<10)
	fmt.Println("[1 << 10 << 10 >> 10]:", 1<<10<<10>>10)

	fmt.Println("06:0110")
	fmt.Println("11:1011")

	z := 0
	if z > 0 && (10/z) > 1 {
		fmt.Println("(10 / z) > 1")
	} else {
		fmt.Println("else")
	}

	fmt.Println("const[KB]:", KB)
}
